<%-- 
    Document   : PatientEditor
    Created on : 14-dic-2011, 14.30.19
    Author     : guybrush
--%>

<%@page import="beans.util.ExtendedDataTableBean"%>
<%@ page contentType="text/html" pageEncoding="UTF-8" %>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

<rich:panel header="#{msg.patient}"
            id="info_pat" style="width: 250px; height: 613px;">
    <a4j:form id="patEdit">
            <h:panelGrid columns="2" columnClasses="cl1, cl2">
                <h:outputText value="#{msg.name}: "/>
                <h:column>
                    <h:message for="edited_name" errorClass="error-message"/>    
                    <rich:inplaceInput id="edited_name" defaultLabel="#{msg.charters_slide}"
                                       value="#{extendedDataTableBean.singleSelectedPat.nome}" validatorMessage="#{msg.error_msg}">
                        <f:validator validatorId="SentenceValidator" />
                    </rich:inplaceInput>
                </h:column>
                <h:outputText value="#{msg.surname}: "/>
                <h:column>
                    <h:message for="edited_surname" errorClass="error-message" />
                    <rich:inplaceInput id="edited_surname" defaultLabel="#{msg.charters_slide}"
                                       value="#{extendedDataTableBean.singleSelectedPat.cognome}" validatorMessage="#{msg.error_msg}">
                        <f:validator validatorId="SentenceValidator" />
                    </rich:inplaceInput>
                </h:column>
                <h:outputText value="#{msg.Username}: "/>
                <h:column>
                    <h:message for="edited_username" errorClass="error-message" />
                    <rich:inplaceInput id="edited_username" defaultLabel="#{msg.charters_slide}"
                                       value="#{extendedDataTableBean.singleSelectedPat.username}" validatorMessage="#{msg.error_msg}">
                        <f:validator validatorId="StringValidator" />
                    </rich:inplaceInput>
                </h:column>
                <h:outputText value="#{msg.Password}: " />
                <h:column>
                    <h:message for="edited_pws" errorClass="error-message" />
                    <rich:inplaceInput id="edited_pws" defaultLabel="#{msg.charters_slide}"
                                       value="#{extendedDataTableBean.singleSelectedPat.password}" validatorMessage="#{msg.error_msg}">
                        <f:validator validatorId="StringValidator" />
                    </rich:inplaceInput>
                </h:column>
                <h:outputText value="#{msg.birthday}: "/>
                <h:column>
                    <h:outputText value="#{extendedDataTableBean.singleSelectedPat.dataNascita}">
                        <f:convertDateTime type="date" dateStyle="long" />
                    </h:outputText>
                    <rich:spacer height="0px" width="1px" />
                    <rich:calendar value="#{extendedDataTableBean.singleSelectedPat.dataNascita}" popup="true"
                                   showInput="false" showApplyButton="true"
                                   direction="bottom-left" jointPoint="bottom-left" />
                </h:column>
                <h:outputText value="#{msg.birthplace}: "/>
                <h:column>
                    <rich:inplaceInput id="edited_birthplace" defaultLabel="#{msg.charters_slide}"
                                       value="#{extendedDataTableBean.singleSelectedPat.luogoNascita}" validatorMessage="#{msg.error_msg}" >
                        <f:validator validatorId="SentenceValidator" />
                    </rich:inplaceInput>
                </h:column>
                <h:outputText value="#{msg.adress}: "/>
                <h:column>
                    <h:message for="edited_address" errorClass="error-message" />
                    <rich:inplaceInput id="edited_address" defaultLabel="#{msg.charters_slide}"
                                       value="#{extendedDataTableBean.singleSelectedPat.indirizzo}" validatorMessage="#{msg.error_msg}">
                        <f:validator validatorId="AddressValidator" />
                    </rich:inplaceInput>
                </h:column>
                <h:outputText value="CAP: "/>
                <h:column>
                    <h:message for="edited_cap" errorClass="error-message" />
                    <rich:inplaceInput id="edited_cap" defaultLabel="#{msg.charters_slide}"
                                       value="#{extendedDataTableBean.singleSelectedPat.cap}" validatorMessage="#{msg.error_msg}" >
                    <f:validator validatorId="CapValidator" />
                </rich:inplaceInput>
                </h:column>
                <h:outputText value="#{msg.longitude}: "/>
                <h:column>
                    <h:message for="edited_long" errorClass="error-message" />
                    <rich:inplaceInput id="edited_long" defaultLabel="#{msg.charters_slide}"
                                       value="#{extendedDataTableBean.singleSelectedPat.longitudine}" validatorMessage="#{msg.error_msg}" >
                        <f:validator validatorId="CoordValidator" />
                    </rich:inplaceInput>
                </h:column>
                <h:outputText value="#{msg.latitude}: "/>
                <h:column>
                    <h:message for="edited_lat" errorClass="error-message" />
                    <rich:inplaceInput id="edited_lat" defaultLabel="#{msg.charters_slide}"
                                       value="#{extendedDataTableBean.singleSelectedPat.latitudine}" validatorMessage="#{msg.error_msg}" >
                        <f:validator validatorId="CoordValidator" />
                    </rich:inplaceInput>
                </h:column>
            </h:panelGrid>
            <h:panelGrid columns="2" columnClasses="b2,b2" width="100%">
                <a4j:commandButton value="#{msg.search}" disabled="#{extendedDataTableBean.updatePatButtonDisable}"
                                   reRender="patEdit, gEdit" action="#{extendedDataTableBean.downloadContent()}"
                                   oncomplete="map.setCenter(new GLatLng(#{extendedDataTableBean.latSingSelctedPat},
                                   #{extendedDataTableBean.longSingSelctedPat}),#{extendedDataTableBean.gzoom})" />
                <a4j:commandButton value="#{msg.update}" disabled="#{extendedDataTableBean.updatePatButtonDisable}"
                                   reRender="tableP, tableE, patButt, patEdit, gEdit, examEdit"
                                   action="#{extendedDataTableBean.updatePatient}" />
            </h:panelGrid>
        </a4j:form>
        <rich:spacer width="100%" height="5px" />
        <rich:gmap id="gmap" style="width: 230px; height: 320px" lat="0.0" lng="0.0" mapType="G_HYBRID_MAP" 
                   zoom="#{extendedDataTableBean.gzoom}" showGLargeMapControl="false" showGMapTypeControl="false" enableContinuousZoom="false"
                   showGScaleControl="false" gmapKey="#{extendedDataTableBean.GKey}" gmapVar="map" />
        <rich:spacer width="100%" height="5px"  />
        <h:form id="gEdit">
            <rich:inputNumberSlider minValue="1" maxValue="18" style="position: fixed; width: 230px" showInput="false"
                                    showBoundaryValues="false" value="#{extendedDataTableBean.gzoom}" onchange="map.setZoom(this.value)" />
            <rich:spacer width="100%" height="20px"  />
            <h:panelGrid columns="3" columnClasses="b1,b2,b3" width="100%">
                <a4j:commandButton value="#{msg.normal}" oncomplete="map.setMapType(G_NORMAL_MAP)" />
                <a4j:commandButton value="Satellite" oncomplete="map.setMapType(G_SATELLITE_MAP)" />
                <a4j:commandButton value="#{msg.hybrid}" oncomplete="map.setMapType(G_HYBRID_MAP)" />
            </h:panelGrid>
        </h:form>
</rich:panel>